#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "mystring.h"

#define MAX_N 100

int main()
{
    if (8 ==  my_strlen("12345678")) puts("pass"); else puts("fail!");

    if (my_strcmp("abc", "abc")) puts("pass"); else puts("fail!");
    if (!my_strcmp("abc", "dbc")) puts("pass"); else puts("fail!");
    if (!my_strcmp("abd", "abc")) puts("pass"); else puts("fail!");

    char str[MAX_N];

    my_strcpy(str, "12345");
    if (my_strcmp(str, "12345")) puts("pass"); else puts("fail!");

    my_strcat(str, "abcde");
    if (my_strcmp(str, "12345abcde")) puts("pass"); else puts("fail!");

    if (my_strstr(str, "abc")) puts("pass"); else puts("fail!");
    if (!my_strstr(str, "f")) puts("pass"); else puts("fail!");
    if (!my_strstr(str, "def")) puts("pass"); else puts("fail!");
    if (my_strstr(str, str)) puts("pass"); else puts("fail!");
    if (my_strstr(str, "2")) puts("pass"); else puts("fail!");

    char *sub = my_strslice(str, 0, 5);
    puts(sub);
    if (my_strcmp(sub, "12345a")) puts("pass"); else puts("fail!");
    free(sub);
    return 0;
}